package exception;

import java.awt.*;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * 当派生类重写超类含有throw声明异常抛出的方法时,堆throws的重写规则
 */
public class ThrowsDemo2 {
    public void dosome() throws IOException, AWTException{}

}

class SubClass extends ThrowsDemo2{
    //public void dosome() throws IOException, AWTException {}//完全相同一定可以
    //public void dosome(){} //不抛出也可以
    //public void dosome() throws IOException{} //仅抛出部分异常也可以
    //public void dosome() throws FileNotFoundException {} //抛出超类声明异常的子类异常

    //不能抛没有的,不能抛父类型异常
    //public void dosome() throws IllegalAgeException {}
    //public void dosome() throws Exception {}
}